//
//  BaseTableViewController.swift
//  微博
//
//  Created by expai on 16/4/28.
//  Copyright © 2016年 guangJun.com.cn. All rights reserved.
//

import UIKit

class BaseTableViewController: UITableViewController, VisitorViewDelegate {

    var userLogin = true
    //定义一个变量
    var visitorView: VisitorView?

    override func loadView() {
        
        userLogin ? super.loadView() : setupVisitorView()

        
    }
    
    private func setupVisitorView(){
        let customView = VisitorView()
        customView.delegate = self
        customView.backgroundColor = UIColor.whiteColor()
        view = customView
        visitorView = customView
    
        navigationItem.leftBarButtonItem = UIBarButtonItem(title: "登录", style: UIBarButtonItemStyle.Plain, target: self, action: #selector(loginBtnWillClick))
        navigationItem.rightBarButtonItem = UIBarButtonItem(title: "注册", style: UIBarButtonItemStyle.Plain, target: self, action: #selector(registerBtnWillClick))

    }
    
    // MARK: - VisitorViewDelegate
    func loginBtnWillClick() {
        print(#function)
    }
    func registerBtnWillClick() {
        print(#function)
    }
     
}

